function showMsg(msg,icon_num){
	layer.alert(msg, {icon: icon_num})
}
function checkLogin(){
    var username = $("input[name=username]").val();
    var password = $("input[name=password]").val();
    if ($.trim(username) == "" ||　$.trim(password) == "") {
        showMsg('用户名密码不能为空',0);
		return false;
    }
	var index = layer.msg('登陆中，请稍候...',{
			time:0,
			shade: [0.3, '#000'],
			icon: 16
		});
    $.ajax({    
        url:changyun_this_url + '/checkLogin',
        data: {
            username : username,
            password : password
        },
        type:'post',
		dataType:'json',
        success:function(data) {
			layer.close(index);
			if(data.status == 1){
				window.location.href = changyun_this_app;
			}else{
				showMsg(data.msg,0);
				return false;
			}
        },    
        error : function() {}    
    });
}

function validatePwd(str){   
    if(str.length!=0){    
        reg=/^[A-Za-z]+[0-9]+[A-Za-z0-9]*|[0-9]+[A-Za-z]+[A-Za-z0-9]*$/;     
        if(!reg.test(str)){    
            return false;  
        } else {
            return true;
        }   
    } 
    return false;    
}